<?php include PATH_TPL."/admin/tpl.header.phtml"?>
<div id="hide" style="display:none;">
        <div class="hide_bloc"></div>
        <img src="../img/img_tip@2x.png" width="50%">
</div>
<div class="main-container inner">
    <div class="main-content">
        <div class="container-fluid">
            <div class="row bt">
                <div class="col-lg-12 bg">
                    <ol class="breadcrumb">
                        <li class="active">
<?//count($tCourse)+count($tLive)?>
                        <i class="fa  fa-fw fa-reorder"></i>老人管理
                        </li>
                    </ol>
                </div>
            </div>
            <div class="row">
                <span class="text-center"><h4>老人信息详细</h4></span>
                <div class="">
                    <span style="margin-left:30px;">个人信息</span>
                    <div class="btn-group" style="margin-left:920px;">
                        <button type="button" id="save" class="btn btn-blue" style="height:30px;text-align:top;border-radius:10%;"><span style="position:relative;bottom:2px;" class="text">保存</span></button>
                        <a href="/admin_senior/" class="btn btn-blue" style="height:30px;text-align:top;margin-left:8px;border-radius:10%;"><span style="position:relative;bottom:2px;" class="text">取消</span></a>
                    </div>
                    <div class="table-group" style="margin-left:50px;margin-top:10px;">
                        <form method="post" enctype="multipart/form-data">
                        <table border="1" style="min-width:600px;font-size:15px;font-family:'宋体';text-align:center;background-color:#F7F7F7;">
                            <tr>
                                <td rowspan="3" id="img_view"><img src="" name="photo" style="wdith:100px;height:100px;"></td>
                                <td>姓名</td> 
                                <td>性别</td> 
                                <td>年龄</td> 
                                <td>民族</td> 
                                <td>宗教</td> 
                                <td>户口所在地</td> 
                                <td>身份证号</td> 
                                <td style="width:10px;">出生年月</td> 
                                <td style="text-align:left;width:10px;">婚姻情况</td> 
                            </tr> 
                            <tr>
                                <td><input type="text" value="" name="senior_name" style="width:100px;height:30px;"/></td>
                                <td>
                                    <select name="sex">
                                        <option value="1">男</option>
                                        <option value="2">女</option>
                                        <option value="0">未知</option>
                                    </select>
                                </td>
                                <td><input type="text" name="age" style="width:50px;"/></td>
                                <td>
                                    <select name="nation">
                                    <?foreach($tNIDatas as $tNIRow){?>
                                    <option value="<?=$tNIRow['num']?>"><?=$tNIRow['introduce']?></option>
                                    <?}?>
                                    </select>
                                </td>
                                <td>
                                    <select name="religion">
                                    <?foreach($tRIDatas as $tRIRow){?>
                                    <option value="<?=$tRIRow['num']?>"><?=$tRIRow['introduce']?></option>
                                    <?}?>
                                    </select>
                                </td>
                                <td><input type="text" name="permanent_residence" style="width:100px;"/></td>
                                <td><input type="text" name="critcode" style="width:135px;"/></td>
                                <td style="width:10px;"><input type="text" name="birth_date" onclick="WdatePicker();" style="width:80px;"/></td>
                                <td>
                                    <select name="married">
                                        <option value="1">未婚</option>
                                        <option value="2">已婚</option>
                                        <option value="3">离异</option>
                                        <option value="4">丧偶</option>
                                    </select>
                                </td>
                            </tr> 
                            <tr>
                                <td>医保卡号</td>
                                <td>基础费用</td>
                                <td>收费折扣</td>
                                <td>支付方式</td>
                                <td>所在部门</td> 
                                <td>文化程度</td> 
                                <td>身体状况</td> 
                                <td style="width:10px;">医保状况</td> 
                            </tr> 
                            <tr>
                                <td><input type="file" style="width:150px;" id="file" name="photo"></td>
                                <td><input type="text" name="card_number" style="width:135px;height:30px;"/></td>
                                <td><input type="text" name="basic_fee" style="width:70px;height:30px;"/></td>
                                <td>
                                    <select name="charge_discount">
                                        <?foreach($tDisDatas as $tDisRow){?>
                                        <option value="<?=$tDisRow['num']?>"><?=$tDisRow['introduce']?></option>
                                        <?}?>
                                    </select>
                                </td>
                                <td>
                                    <select name="payment">
                                        <?foreach($tPIDatas as $tPIRow){?>
                                        <option value="<?=$tPIRow['num']?>"><?=$tPIRow['introduce']?></option>
                                        <?}?>
                                        
                                    </select>
                                </td>
                                <td>
                                    <select name="department">
                                    <?foreach($tDIDatas as $tDIRow){?>
                                    <option value="<?=$tDIRow['num']?>"><?=$tDIRow['introduce']?></option>
                                    <?}?>
                                    </select>
                                </td>
                                <td>
                                    <select name="education_levels">
                                    <?foreach($tEIDatas as $tEIRow){?>
                                    <option value="<?=$tEIRow['num']?>"><?=$tEIRow['introduce']?></option>
                                    <?}?>
                                    </select>
                                </td>
                                <td>
                                    <select name="body_status">
                                    <?foreach($tBIDatas as $tBIRow){?>
                                    <option value="<?=$tBIRow['num']?>"><?=$tBIRow['introduce']?></option>
                                    <?}?>
                                    </select>
                                </td>
                                <td style="width:10px;">
                                    <select name="medical_status">
                                        <option value="1">有</option>
                                        <option value="2">无</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>入住前住址</td>
                                <td colspan="4" style="text-align:left;"><input type="text" name="old_address" style="width:300px;height:30px;margin-left:20px;"/></td>
                                <td>原工作单位</td>
                                <td colspan="3" style="text-align:left;width:230px;"><input type="text" name="old_company" style="width:260px;height:30px;margin-left:20px;"/></td>
                            </tr>
                            <tr>
                                <td>脾气/爱好</td>
                                <td colspan="4" style="text-align:left;"><input type="text" name="temper_hobby" style="width:300px;height:30px;margin-left:20px;"/></td>
                                <td>病史/过敏</td>
                                <td colspan="4" style="text-align:left;width:230px;"><input type="text" name="allergies" style="width:260px;height:30px;margin-left:20px;"/></td>
                            </tr> 
                            <tr>
                                <td colspan="14" border="0" style="background-color:#ffffff">&nbsp;</td>
                            </tr>
                            <tr>
                                <td rowspan="2">委托人</td>
                                <td style="height:40px;width:20px;">姓名</td>
                                <td style="width:100px;text-align:left;"><input name="wt_name" style="width:100px;" type="text" name="" /></td>
                                <td style="height:40px;width:20px;">关系</td>
                                <td style="width:100px;text-align:left;"><input name="wt_relation"style="width:100px;" type="text" value="" /></td>
                                <td>联系电话</td>
                                <td colspan="3" style="width:200px;text-align:left;"><input name="wt_phone" style="width:300px;" type="text" value="" /></td>
                                <td>是否欠费</td>
                            </tr>
                            <tr>
                                <td style="height:40px;width:20px;">住址</td>
                                <td colspan="3" style="text-align:left;"><input type="text" name="wt_address" style="width:250px;"></td>
                                <td>证件号码</td>
                                <td colspan="3" style="width:200px;text-align:left;"><input name="wt_critcode" style="width:300px;" type="text" value="" /></td>
                                <td>
                                    <select name="is_talk">
                                        <option value="1">否</option>
                                        <option value="2">是</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td rowspan="3">习惯</td>    
                                <td>饮食</td>
                                <td style="text-align:left;" colspan="8">
                                    <textarea name="diet" style="width:660px;height:90px;margin-left:6px;"></textarea>
                                </td>    
                            </tr>
                            <tr>
                                <td>生活</td>
                                <td style="text-align:left;" colspan="8">
                                    <textarea name="life" style="width:660px;height:90px;margin-left:6px;"></textarea>
                                </td>    
                            </tr>
                            <tr>
                                <td>睡眠</td>
                                <td style="text-align:left;" colspan="8">
                                    <textarea name="sleep" style="width:660px;height:90px;margin-left:6px;"></textarea>
                                </td>    
                            </tr>
                            <tr>
                                <td>用药医嘱</td>
                                <td style="text-align:left;" colspan="9">
                                    <textarea name="medical_orders" style="width:756px;height:90px;margin-left:45px;"></textarea>
                                </td>    
                            </tr>
                            <tr>
                                <td>自测身体检查</td>
                                <td style="text-align:left;" colspan="9">
                                    <textarea name="physical_examination" style="width:756px;height:90px;margin-left:45px;"></textarea>
                                </td>    
                            </tr>
                            <tr>
                                <td>出院诊断</td>
                                <td style="text-align:left;" colspan="9">
                                    <textarea name="discharge_diagnosis" style="width:756px;height:90px;margin-left:45px;"></textarea>
                                </td>    
                            </tr>
                            <tr>
                                <td>随身物品</td>
                                <td style="text-align:left;" colspan="9">
                                    <textarea name="goods" style="width:756px;height:90px;margin-left:45px;"></textarea>
                                </td>    
                            </tr>
                        </table> 
                        <table border="1" style="min-width:1037px;font-size:15px;font-family:'宋体';text-align:center;background-color:#F7F7F7;">
                            <tr>
                                <td colspan="14" border="0" style="background-color:#ffffff">
                                    <span>家属信息</span>
                                    <button type="button" id="addQinshu" class="btn btn-blue" style="margin-left:50px;" onclick="addJiashu();">添加</button>
                                </td>
                            </tr>
                            <tr class="qinshu">
                                <td>姓名</td>
                                <td>性别</td>
                                <td colspan="2">关系</td>
                                <td colspan="2">身份证号</td>
                                <td colspan="3">家庭住址</td>
                                <td>操作</td>
                            </tr>
                            </table>
                        <table border="1" style="margin-bottom:100px;width:1037px;font-size:15px;font-family:'宋体';text-align:left;background-color:#F7F7F7;">
                            <tr>
                                <td colspan="13" border="0" style="background-color:#ffffff;text-align:center;">
                                    <span>扫描件信息</span>
                                    <!--<button type="button" id="addQinshu" class="btn btn-blue" style="margin-left:50px;" onclick="addJiashu();">添加</button>-->
                                </td>
                            </tr>
                            <tr>
                                <td style="background:#fff"> 
                                   <div class="table-img" style="max-width:1037px;margin-right:10px;float:left;">
                                        <input type="file" class="fileimgBtn" name="file_img[]" multiple="multiple" id="file_img" style="display:none;"/>
                                        <div class="imgAdd" style="float:left;"></div>
                                        <img class="scanning-url" src="/img/icon_add@2x.png" style="widtj:100px;height:100px;"> 
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>  
                </div>
                        </form>
            </div>
        </div><!--container-fluid  -->
    </div><!--main-content  -->
</div><!--main-container  -->
<script type="text/javascript" src="/viewer/viewer-jquery.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="/plugins/datepicker/WdatePicker.js" charset="UTF-8"></script>
<script type="text/javascript">

var reader = new FileReader();
var upload = function(){};

upload.prototype.input_file_click = function(filename){
    var fileObj = $('input[name="'+filename+'"]'); 
    fileObj.bind('change',function(){
        var file = document.getElementById(filename.replace("[]","")).files;  
        for(var i in file){
            //将文件以Data URL形式读入页面  
            var reader = new FileReader();  
            reader.readAsDataURL(file[i]);  
            reader.onload=function(e){  
                $('#'+filename.replace("[]","")).before('<img data-original="'+e.target.result+'" data="img_min" class="img_min" src="' + e.target.result +'" alt="" style="float:left;margin-right:10px;margin-bottom:20px;"/>');  
            };
        }
        fileObj.unbind('change');
    });
    fileObj.click();
}
var up  = new upload();
$(function(){
    $('.scanning-url').on('click',function(){
        up.input_file_click('file_img[]');
    });
    $('.img_min').each(function(){
        $(this).on('click',function(){
           $(this).toggleClass('img_min'); 
           $(this).toggleClass('img_max'); 
        });
    });
});
$(function(){
//提交
    var options={
        beforeSubmit : showRequest,    // 提交前的回调函数
        success : showResponse,    // 提交后的回调函数
        dataType : "json",    // html（默认）、xml、script、json接受服务器端返回的类型
        timeout : 3000    // 限制请求的时间，当请求大于3秒后，跳出请求
    }
    function showRequest(formData, jqForm, options){
        return true;
    }
    function showResponse(responseText,statusText){
        cg_alert_add(responseText,'/admin_senior','/admin_senior/add');
    }
    $('#save').click(function(){
       $('form').ajaxSubmit(options); 
    });
    $('#search').click(function(){
        $('form').submit();
    });


});
function showdate(){
    jinzhi=0
    var h=document.documentElement.clientHeight;
    var s=$(document).scrollTop();
    var newh=h+'px';
    var newt=s+'px';
    $('#hide').show()
    $('#hide').css({'height':newh,"top":newt})
    $("body").css({"overflow":"hidden"});
    $('.hide_block').click(function(){
        jinzhi=1;
        $('#hide').hide()
        $("body").css({"overflow":"auto"});
    })
}
    var i = 2;
function addJiashu(){
    $('.qinshu').after('<tr class="jiashu"><td><input type="text" name="js_name[]" style="width:100px;" /></td><td><select name="js_sex[]"><option value="1">男</option><option value="2">女</option><option value="3">未知</option></select></td><td colspan="2"><input type="text" name="js_relation[]" style="width:100px;" /></td><td colspan="2"><input type="text" name="js_critcode[]" style="width:180px;" /></td><td colspan="3"><input type="text" name="js_address[]" style="width:300px;" /></td><td><button type="button" class="delete_jiashu btn btn-blue">删除</td></tr>');
    i++;
    $('.delete_jiashu').click(function(){
        $(this).parent().parent().remove();
    });
}
var result = document.getElementById('img_view');
var input = document.getElementById('file');
if(typeof FileReader==='undefined'){
    result.innerHTML = '抱歉，你的浏览器不支持 FileReader';
    input.setAttribute('disabled','disabled');
}else{
    input.addEventListener('change',readFile,false);
}
function readFile(){
    var file = this.files[0];
    var reader = new FileReader();  
    if(!/image\/\w+/.test(file.type)){
        alert('文件必须为图片');
        return false;
    }
    reader.readAsDataURL(file);
    reader.onload = function(e){
        $('img[name="photo"]').attr('src',this.result);
    }
}
</script>



<?php include PATH_TPL."/admin/tpl.footer.phtml"?>